home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_203 / gurusguide / swi.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  77 lines

  1. /************************************************************************
  2. **********                                                     **********
  3. **********         S O F T W A R E   I N T E R R U P T         **********
  4. **********         -----------------------------------         **********
  5. **********                                                     **********
  6. **********        Copyright (C) 1988 Sassenrath Research       **********
  7. **********                All Rights Reserved.                 **********
  8. **********                                                     **********
  9. **********    Example from the "Guru's Guide, Meditation #1"   **********
  10. **********                                                     **********
  11. *************************************************************************
  12. **                                                                     **
  13. **                            - NOTICE -                               **
  14. **                                                                     **
  15. **  The "Guru's Guide, Meditation #1" contains detailed information    **
  16. **  about Amiga interrupts as well as a complete discussion of this    **
  17. **  and other examples.  Meditation #1 and all of its examples were    **
  18. **  written by Carl Sassenrath, the architect of Amiga's multitasking  **
  19. **  operating system.  Copies of the "Guru's Guide" may be obtained    **
  20. **  from:                                                              **
  21. **           GURU'S GUIDE, P.O. BOX 1510, UKIAH, CA 95482              **
  22. **                                                                     **
  23. **  Please include a check for $14.95, plus $1.50 shipping ($4.00 if   **
  24. **  outside North America).  CA residents add 6% sales tax.            **
  25. **                                                                     **
  26. **  This example may be used for any purposes, commercial, personal,   **
  27. **  public, and private, so long as ALL of the above text, copyright,  **
  28. **  mailing address, and this notice are retained in their entirety.   **
  29. **                                                                     **
  30. **  THIS EXAMPLE IS PROVIDED WITHOUT WARRANTY OF ANY KIND.             **
  31. **                                                                     **
  32. ************************************************************************/
  33.  
  34. /*
  35. **  COMPILATION NOTE:
  36. **
  37. **  Compiled under MANX AZTEC C 3.6A.  Use the +L compiler option
  38. **  and the "c32" library.  Link with intrsup.o
  39. */
  40.  
  41.  
  42. #include <exec/interrupts.h>
  43.  
  44. long Counter = 0;
  45.  
  46.  
  47. /* Interrupt Processing Code */
  48. IntrProc()
  49. {
  50.     int_start();
  51.  
  52.     Counter++;
  53.  
  54.     int_end();
  55. }
  56.  
  57.  
  58. main()
  59. {
  60.     extern struct Interrupt *MakeIntr();
  61.     extern int Enable_Abort;
  62.     struct Interrupt *intr;
  63.  
  64.     Enable_Abort = 0;    /* prevent a CTRL-C */
  65.  
  66.     intr = MakeIntr("softint.example",0,&IntrProc,0);
  67.     if (intr == NULL) exit(100);
  68.  
  69.     while (Counter < 10)
  70.     {
  71.         Cause(intr);
  72.         printf("%d\n", Counter);
  73.     }
  74.  
  75.     FreeIntr(intr);
  76. }
  77.